#include "stdafx.h"
#include <string>
#include <list>
#include "Player.h"
#include "Action.h"
#include "Hand.h"
#include <cassert>

using namespace std;

Hand::Hand(string tableName, string id, float sb, float bb, string dateTime, int button, string holeCard1, string holeCard2,
		   list<string> & dealtCards, list<Result> & results, list<Player> & players, list<Action> & actions)
{
	tableName_ = tableName;
	id_ = id;
	sb_ = sb;
	bb_ = bb;
	dateTime_ = dateTime;
	button_ = button;
	holeCard1_ = holeCard1;
	holeCard2_ = holeCard2;
	dealtCards_ = dealtCards;
	results_ = results;
	players_ = players;
	actions_ = actions;
}

Player Hand::GetPlayer(std::string playerName) const
{
	list<Player>::const_iterator playerIt;

	for(playerIt = players_.begin(); playerIt != players_.end(); playerIt++)
	{
		if (playerIt->Name().compare(playerName) == 0)
		{
			return (*playerIt);
		}
	}

	// If get here, then playerName doesn't exist
	assert(0);
	Player p;
	return p;
}